# 权限
# 编写一个名为Privileges 的类，它只有一个属性privileges ，其中存储 了练习9-7所述的字符串列表。将方法show_privileges() 移到这个类中。
# 在Admin 类中，将 一个Privileges 实例用作其属性。创建一个Admin 实例，并使用方法show_privileges() 来显示其权限。

class User:
    def __init__(self, first_name, last_name):
        self.first_name = first_name
        self.last_name = last_name

    def describe_user(self):
        print(f"first_name: {self.first_name}")
        print(f"last_name: {self.last_name}")

    def greet_user(self):
        print(f"Hello, {self.first_name} {self.last_name}!")


class Privileges:

    def __init__(self, privileges):
        self.privileges = privileges

    def show_privileges(self, first_name, last_name):
        print(
            f"{first_name.title()} {last_name.title()} has privilege(s): {self.privileges}.")


class Admin(User):

    def __init__(self, first_name, last_name, privileges):
        super().__init__(first_name, last_name)
        self.privileges = Privileges(privileges)


admin = Admin("gaoshi", "nol",
              ['can add post', 'can delete post', 'can ban user'])
admin.describe_user()
admin.greet_user()
admin.privileges.show_privileges(admin.first_name, admin.last_name)
